package com.borrower.action;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;

public class ExitAction extends Action{
    @Override
    public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        HttpSession session = request.getSession();
        PrintWriter out=response.getWriter();
        String loginName = String.valueOf(session.getAttribute("loginName"));
        if(loginName==null){
            out.println("<script>alert('请登录');parent.window.location.href='login.html';</script>");
            return;
        }

        session.invalidate();
//        out.print("<script>parent.window.location.href='borrower.html';</script>");

out.print(true);
        //1.清除session

    }
}
